// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   QuickServerConfig.java

package org.quickserver.util.xmlreader;

import org.quickserver.net.server.QuickServer;

// Referenced classes of package org.quickserver.util.xmlreader:
//            BasicServerConfig, ServerMode, DefaultDataMode, ObjectPoolConfig, 
//            DBObjectPoolConfig, AccessConstraintConfig, QSAdminServerConfig, ApplicationConfiguration, 
//            ServerHooks, InitServerHooks, Secure, AdvancedSettings

public class QuickServerConfig extends BasicServerConfig
{

    public QuickServerConfig()
    {
        securityManagerClass = null;
        configFile = null;
        applicationJarPath = null;
        setName((new StringBuilder("QuickServer v")).append(QuickServer.getVersion()).toString());
    }

    public void setQSAdminServerConfig(QSAdminServerConfig config)
    {
        qSAdminServerConfig = config;
    }

    public QSAdminServerConfig getQSAdminServerConfig()
    {
        return qSAdminServerConfig;
    }

    public void setDBObjectPoolConfig(DBObjectPoolConfig dDObjectPoolConfig)
    {
        this.dDObjectPoolConfig = dDObjectPoolConfig;
    }

    public DBObjectPoolConfig getDBObjectPoolConfig()
    {
        return dDObjectPoolConfig;
    }

    public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration)
    {
        this.applicationConfiguration = applicationConfiguration;
    }

    public ApplicationConfiguration getApplicationConfiguration()
    {
        return applicationConfiguration;
    }

    public void setSecurityManagerClass(String securityManagerClass)
    {
        if(securityManagerClass != null)
            this.securityManagerClass = securityManagerClass;
    }

    public String getSecurityManagerClass()
    {
        return securityManagerClass;
    }

    protected void setConfigFile(String fileName)
    {
        configFile = fileName;
    }

    public String getConfigFile()
    {
        return configFile;
    }

    public void setApplicationJarPath(String applicationJarPath)
    {
        this.applicationJarPath = applicationJarPath;
    }

    public String getApplicationJarPath()
    {
        return applicationJarPath;
    }

    public void setInitServerHooks(InitServerHooks initServerHooks)
    {
        this.initServerHooks = initServerHooks;
    }

    public InitServerHooks getInitServerHooks()
    {
        return initServerHooks;
    }

    public String toXML(String pad)
    {
        if(pad == null)
            pad = "";
        StringBuilder sb = new StringBuilder();
        sb.append((new StringBuilder(String.valueOf(pad))).append("<quickserver>\n").toString());
        if(getName() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<name>").append(getName()).append("</name>\n").toString());
        if(getServerBanner() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<server-banner>").append(getServerBanner()).append("</server-banner>\n").toString());
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t<port>").append(getPort()).append("</port>\n").toString());
        if(getBindAddr() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<bind-address>").append(getBindAddr()).append("</bind-address>\n").toString());
        sb.append(getServerMode().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        if(getClientEventHandler() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<client-event-handler>").append(getClientEventHandler()).append("</client-event-handler>\n").toString());
        if(getClientCommandHandler() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<client-command-handler>").append(getClientCommandHandler()).append("</client-command-handler>\n").toString());
        if(getClientObjectHandler() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<client-object-handler>").append(getClientObjectHandler()).append("</client-object-handler>\n").toString());
        if(getClientBinaryHandler() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<client-binary-handler>").append(getClientBinaryHandler()).append("</client-binary-handler>\n").toString());
        if(getClientWriteHandler() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<client-write-handler>").append(getClientWriteHandler()).append("</client-write-handler>\n").toString());
        if(getClientAuthenticationHandler() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<client-authentication-handler>").append(getClientAuthenticationHandler()).append("</client-authentication-handler>\n").toString());
        else
        if(getAuthenticator() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<authenticator>").append(getAuthenticator()).append("</authenticator>\n").toString());
        if(getClientData() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<client-data>").append(getClientData()).append("</client-data>\n").toString());
        if(getClientExtendedEventHandler() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<client-extended-event-handler>").append(getClientExtendedEventHandler()).append("</client-extended-event-handler>\n").toString());
        sb.append(getDefaultDataMode().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t<timeout>").append(getTimeout()).append("</timeout>\n").toString());
        if(getTimeoutMsg() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<timeout-msg>").append(getTimeoutMsg()).append("</timeout-msg>\n").toString());
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t<max-auth-try>").append(getMaxAuthTry()).append("</max-auth-try>\n").toString());
        if(getMaxAuthTryMsg() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<max-auth-try-msg>").append(getMaxAuthTryMsg()).append("</max-auth-try-msg>\n").toString());
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t<max-connection>").append(getMaxConnection()).append("</max-connection>\n").toString());
        if(getMaxConnectionMsg() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<max-connection-msg>").append(getMaxConnectionMsg()).append("</max-connection-msg>\n").toString());
        if(getConsoleLoggingLevel() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<console-logging-level>").append(getConsoleLoggingLevel()).append("</console-logging-level>\n").toString());
        if(getConsoleLoggingFormatter() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<console-logging-formatter>").append(getConsoleLoggingFormatter()).append("</console-logging-formatter>\n").toString());
        sb.append(getObjectPoolConfig().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t<communication-logging>\n").toString());
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t\t<enable>").append(getCommunicationLogging()).append("</enable>\n").toString());
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t</communication-logging>\n").toString());
        if(getDBObjectPoolConfig() != null)
            sb.append(getDBObjectPoolConfig().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        if(getSecurityManagerClass() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<security-manager-class>").append(getSecurityManagerClass()).append("</security-manager-class>\n").toString());
        if(getAccessConstraintConfig() != null)
            sb.append(getAccessConstraintConfig().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        if(getQSAdminServerConfig() != null)
            sb.append(getQSAdminServerConfig().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        if(getApplicationConfiguration() != null)
            sb.append(getApplicationConfiguration().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        if(getApplicationJarPath() != null)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<application-jar-path>").append(getApplicationJarPath()).append("</application-jar-path>\n").toString());
        if(getServerHooks() != null)
            sb.append(getServerHooks().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        if(getInitServerHooks() != null)
            sb.append(getInitServerHooks().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        sb.append(getSecure().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        sb.append(getAdvancedSettings().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        sb.append((new StringBuilder(String.valueOf(pad))).append("</quickserver>\n").toString());
        return sb.toString();
    }

    public String toString()
    {
        return toXML(null);
    }

    private QSAdminServerConfig qSAdminServerConfig;
    private DBObjectPoolConfig dDObjectPoolConfig;
    private ApplicationConfiguration applicationConfiguration;
    private InitServerHooks initServerHooks;
    private String securityManagerClass;
    private String configFile;
    private String applicationJarPath;
}
